import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode:"history",
  base:"/car_app/",
  routes: [
    {
      path:"/",
      redirect:"/homepage"
    },
    {
      path:"/login",
      component:resolve => require(['../components/login.vue'], resolve),
    },
    {
      path:"what?",
      component:resolve => require(['../components/common/model.vue'], resolve),
      children:[
        {
          path: '/homepage',
          component:resolve => require(['../components/homepage/homepage.vue'], resolve)
        },{
          path:"/members",
          component:resolve => require(['../components/members/menu.vue'], resolve)
        },{
          path:"/more",
          component:resolve => require(['../components/more/menu.vue'], resolve)
        },{
          path:"/works",
          component:resolve => require(['../components/works/menu.vue'], resolve),
          meta:{
            keepAlive:true,
          }
        }
      ]
    },

    // 预约服务
    {
      path:"/appoints",
      component:resolve => require(['../components/homepage/appoints/appoint.vue'], resolve)
    },
    // 车辆续约
    {
      path:"/carsrenew",
      component:resolve=>require(['../components/homepage/renew/renew.vue'],resolve)
    },
    // 顾问咨询
    {
      path:"/advisers",
      component:resolve=>require(['../components/homepage/advisers/adviser.vue'],resolve)
    },{
      path:"/advisers/change/:type/:id",
      component:resolve=>require(['../components/homepage/advisers/otherlist.vue'],resolve)
    },

    // 新车专区
    {
      path:"/newuser",
      component:resolve=>require(['../components/homepage/newuser/newuser.vue'],resolve)
    },

    // 车况信息
    {
      path:"/condition",
      component:resolve=>require(['../components/homepage/condition/condition.vue'],resolve)
    },{
      path:"/condition/carinfo",
      component:resolve=>require(['../components/homepage/condition/carDetail.vue'],resolve)
    },{
      path:"/condition/checkinfo",
      component:resolve=>require(['../components/homepage/condition/checkDetail.vue'],resolve)
    },{
      path:"/condition/serveinfo",
      component:resolve=>require(['../components/homepage/condition/serveDetail.vue'],resolve)
    },

    // 养车知识
    {
      path:"/carsense",
      component:resolve=>require(['../components/homepage/carsense/carsense.vue'],resolve)
    },{
      path:"/carsense/detail/:id",
      component:resolve=>require(['../components/homepage/carsense/detail.vue'],resolve)
    },


    // 优惠活动
    {
      path:"/discount",
      component:resolve=>require(['../components/homepage/discount/discount.vue'],resolve)
    },{
      path:"/discount/detail",
      component:resolve=>require(['../components/homepage/discount/detail.vue'],resolve)
    },{
      path:"/discount/detail/:id",
      component:resolve=>require(['../components/homepage/discount/detail.vue'],resolve)
    },

    // 三人拼团
    {
      path:"/regiment",
      component:resolve=>require(['../components/homepage/regiment/regiment.vue'],resolve)
    },{
      path:"/regiment/join",
      component:resolve=>require(['../components/homepage/regiment/detail.vue'],resolve),
      name:"regimentJoin"
    },{
      path:"/regiment/open",
      component:resolve=>require(['../components/homepage/regiment/detail.vue'],resolve),
      name:"regimentOpen"
    },


    // 会员
    {
      path:"/settings",
      component:resolve=>require(['../components/members/settings/settings.vue'],resolve),
    },{
      path:"/member/center",
      component:resolve=>require(['../components/members/center/center.vue'],resolve),
    },{
      path:"/member/consume",
      component:resolve=>require(['../components/members/center/consume/consume.vue'],resolve),
    },{
      path:"/member/integral",
      component:resolve=>require(['../components/members/center/integral/integral.vue'],resolve),
    },{
      path:"/member/recharge",
      component:resolve=>require(['../components/members/center/recharge/recharge.vue'],resolve),
    },{
      path:"/fullmoney",
      component:resolve=>require(['../components/members/fullmoney/fullmoney.vue'],resolve),
    },{
      path:"/member/voucher",
      meta:{
        catchingName:"voucherDetail",//从改名字跳转过来时，使用缓存数据
        keepAlive:false,//判断当前路由是否需要缓存
      },
      component:resolve=>require(['../components/members/voucher/voucher.vue'],resolve),
    },{
      path:"/member/voucher/detail/:id",
      name:"voucherDetail",
      component:resolve=>require(['../components/members/voucher/detail.vue'],resolve),
    },{
      path:"/member/voucher/share",
      component:resolve=>require(['../components/members/voucher/share.vue'],resolve),
    },{
      path:"/member/voucher/shareInfo/:id",
      component:resolve=>require(['../components/members/voucher/common/toShare.vue'],resolve),
    },{
      path:"/member/voucher/attention",
      component:resolve=>require(['../components/members/voucher/common/attention.vue'],resolve),
    },
    // 订单
    {
      path:"/member/myorder",
      component:resolve=>require(['../components/members/order/myorder.vue'],resolve),
    },{
      path:"/member/myorder/activity",
      component:resolve=>require(['../components/members/order/activity/activity.vue'],resolve),
    },{
      path:"/member/myorder/rules",
      component:resolve=>require(['../components/members/order/rules/rules.vue'],resolve),
    },

    // 套餐
    {
      path:"/member/meals",
      component:resolve=>require(['../components/members/meal/meal.vue'],resolve),
    },

    // 意见反馈
    {
      path:"/member/feedback",
      component:resolve=>require(['../components/members/feedback/feedback.vue'],resolve),
    },{
      path:"/member/feedback/result",
      component:resolve=>require(['../components/members/feedback/result.vue'],resolve),
    },{
      path:"/member/feedback/records",
      component:resolve=>require(['../components/members/feedback/record/records.vue'],resolve),
    },

    // 问卷调查
    {
      path:"/member/investigation",
      component:resolve=>require(['../components/members/investigation/investigation.vue'],resolve),
    },

    // 推荐有礼
    {
      path:"/member/groom",
      component:resolve=>require(['../components/members/groom/groom.vue'],resolve),
    },

    // 我的消息
    {
      path:"/member/infomation",
      component:resolve=>require(['../components/members/infomation/info.vue'],resolve),
    },{
      path:"/member/infomation/:type",
      component:resolve=>require(['../components/members/infomation/detail.vue'],resolve),
    },


    // 更多
    {
      path:"/more/help",
      component:resolve=>require(['../components/more/help/help.vue'],resolve),
    },{
      path:"/more/serve",
      component:resolve=>require(['../components/more/serve/serve.vue'],resolve),
    },


    // 工作台
    {
      path:"/works/news",
      component:resolve=>require(['../components/works/news/news.vue'],resolve),
    },{
      path:"/works/customer",
      component:resolve=>require(['../components/works/customer/customer.vue'],resolve),
    },{
      path:"/works/customer/detail",
      component:resolve=>require(['../components/works/customer/detail.vue'],resolve),
    },

    // 卡券派发
    {
      path:"/works/card",
      component:resolve=>require(['../components/works/card/card.vue'],resolve),
    },{
      path:"/works/card/send",
      component:resolve=>require(['../components/works/card/tosend.vue'],resolve),
    },

    // 活动列表
    {
      path:"/works/activities",
      component:resolve=>require(['../components/works/activities/activities.vue'],resolve),
    },{
      path:"/works/activities/signlist",
      component:resolve=>require(['../components/works/activities/signList.vue'],resolve),
    },{
      path:"/works/activities/prizelist",
      component:resolve=>require(['../components/works/activities/prizeList.vue'],resolve),
    },{
      path:"/works/activities/prizelist/type",
      component:resolve=>require(['../components/works/activities/common/prize.vue'],resolve),
    },{
      path:"/works/activities/suggestlist",
      component:resolve=>require(['../components/works/activities/common/suggest.vue'],resolve),
    },{
      path:"/works/activities/suggestlist/detail",
      component:resolve=>require(['../components/works/activities/common/suggestdetail.vue'],resolve),
    },

    // 售后预约
    {
      path:"/works/aftersale",
      component:resolve=>require(['../components/works/aftersale/aftersale.vue'],resolve),
    },{
      path:"/works/aftersale/detail",
      component:resolve=>require(['../components/works/aftersale/common/detail.vue'],resolve),
    },

    // 接车服务
    {
      path:"/works/cars",
      component:resolve=>require(['../components/works/cars/cars.vue'],resolve),
      meta:{
        keepAlive:true,
      }
    },{
      path:"/works/cars/report/:id",
      component:resolve=>require(['../components/works/cars/report.vue'],resolve),
      meta:{
        keepAlive:true,
      }
    },

    // 销售排行
    {
      path:"/works/salerank",
      component:resolve=>require(['../components/works/salerank/salerank.vue'],resolve),
    }
  ]
})
